﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NanjingbeiRailwayStation.Core
{
    /// <summary>
    /// 事件类型表 固定
    /// </summary>
    public class EventTypeTable
    {
        static readonly List<EventTypeRow> Rows = new List<EventTypeRow>();
        static EventTypeTable()
        {

            Rows.Add(new EventTypeRow() { 
            
                EventName= "PowerOff",
                EventDescription= "系统断电",
                EventLevel="三级"
            });
            Rows.Add(new EventTypeRow()
            {

                EventName = "PowerOn",
                EventDescription = "系统上电",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "485Locked",
                EventDescription = "通讯闭锁",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "PeOpenReset",
                EventDescription = "PE 线开路恢复",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "InWaterReset",
                EventDescription = "浸水报警恢复",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "SettingChanged",
                EventDescription = "设置更改",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "CloudLocked",
                EventDescription = "云端闭锁",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "ManualClear",
                EventDescription = "手动消音",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "ManualReset",
                EventDescription = "手动复位",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "ManualSelfCheck",
                EventDescription = "手动自检",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "VolHighReset",
                EventDescription = "过压报警恢",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "VolLowReset",
                EventDescription = "欠压报警恢复",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "PhaseLossReset",
                EventDescription = "缺相报警恢复",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "LeakageReset",
                EventDescription = "漏电报警恢复",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "OverloadReset",
                EventDescription = "过载报警恢复",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "HighPowerReset",
                EventDescription = "过功率报警恢复",
                EventLevel = "三级"
            });


            Rows.Add(new EventTypeRow()
            {

                EventName = "TooHotReset",
                EventDescription = "高温报警恢复",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "RemoteClear",
                EventDescription = "远程消音",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "RemoteReset",
                EventDescription = "远程复位",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "RemoteSelfCheck",
                EventDescription = "远程自检",
                EventLevel = "三级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "VolHighAlarm",
                EventDescription = "过压报警",
                EventLevel = "二级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "VolLowAlarm",
                EventDescription = "欠压报警",
                EventLevel = "二级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "PhaseLossAlarm",
                EventDescription = "缺相报警",
                EventLevel = "二级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "LeakageAlarm",
                EventDescription = "漏电报警",
                EventLevel = "二级"
            });


            Rows.Add(new EventTypeRow()
            {

                EventName = "OverLoadAlarm",
                EventDescription = "过载报警",
                EventLevel = "二级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "HighPowerAlarm",
                EventDescription = "过功率报警",
                EventLevel = "二级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "InWaterAlarm",
                EventDescription = "浸水报警",
                EventLevel = "二级"
            });

            Rows.Add(new EventTypeRow()
            {

                EventName = "PeOpenAlarm",
                EventDescription = "PE 线开路报警",
                EventLevel = "二级"
            });
            Rows.Add(new EventTypeRow()
            {

                EventName = "HighTempAlarm",
                EventDescription = "温报报警",
                EventLevel = "二级"
            });

            ///
            Rows.Add(new EventTypeRow()
            {

                EventName = "I_UnblanceAlarm",
                EventDescription = "不平衡报警",
                EventLevel = "二级"
            });

        }
        /// <summary>
        /// 事件 描述
        /// </summary>
        /// <param name="eventName"></param>
        /// <returns></returns>
        public static string GetEventDescription(string eventName)
        {
            var row = Rows.FirstOrDefault(item =>  string.Compare( item.EventName , eventName,true)==0);

            if (row == null) 
                {
                    return string.Empty;
                }
            return row.EventDescription;
        }

        /// <summary>
        /// 事件 等级
        /// </summary>
        /// <param name="eventName"></param>
        /// <returns></returns>
        public static string GetEventLevel(string eventName)
        {
            var row = Rows.FirstOrDefault(item => string.Compare(item.EventName, eventName, true) == 0);

            if (row == null)
            {
                return string.Empty;
            }
            return row.EventLevel;

        }
    }
}
